<?php
// +----------------------------------------------------------------------
// | Search.php [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016-2017 limingxinleo All rights reserved.
// +----------------------------------------------------------------------
// | Author: limx <715557344@qq.com> <https://github.com/limingxinleo>
// +----------------------------------------------------------------------

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Traits\Curl;

class Search extends Command
{
    use Curl;
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'search';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Search Book';

    /**
     * The drip e-mail service.
     *
     * @var DripEmailer
     */
    protected $drip;

    /**
     * Create a new command instance.
     *
     * @param  DripEmailer $drip
     * @return void
     */
    public function __construct()
    {
        parent::__construct();

    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $url = "http://se.qidian.com/";
        $res = self::curlGet($url, ['kw' => '倚天屠龙']);
        preg_match_all("/<h4><a href=\"(.*?)\" .+?>(.+?)<\/a><\/h4>/", $res, $result);
        print_r($result[1]);
        print_r($result[2]);
    }
}